#ifndef SUPERSOCKET_H
#define SUPERSOCKET_H
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
#include <QHostAddress>
#include <QMap>
class SuperSocket :public QObject
{
    Q_OBJECT
public:
    SuperSocket();
public:
    void    CreateServer(quint16 port ,int &);
    bool    CreateClient(QString ip, quint16 port);
    int     ClientSendBuff(QByteArray buff);
    void    CloseTCP();
    int     ServerSendBuff(QByteArray buff,QString IpAddress);
signals:
    void ServerResive(QString ip,QByteArray buff);
    void ClientResive(QByteArray buff);
private:
    QMap<QString,QTcpSocket*>   m_socketmap;
    QMap<QString,QString>       m_readMsg;
    QTcpServer *m_server;
    QTcpSocket *m_socket;
private:
    unsigned char CRC8(QByteArray buffer, int startlength, int length);
};

#endif // SUPERSOCKET_H
